You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initial main baseline e2074b1 exposed only ceil(max(JSON,TOON UTF-8 bytes)/4) under a token-shaped compatibility field. It had no exact per-renderer byte costs and maintained its own unbounded fixed-point loop. Two failing-first tests reproduced the missing byte API in real temporary non-git SDK trackers; the Unicode/digest fixture measured 2301 JSON / 1775 TOON bytes while the byte fields were absent.
The packet now exposes exact self-inclusive bytes.json and bytes.toon, including the final renderer newline and all domain/SDK accounting fields. The compatibility estimatedTokens field remains, explicitly labeled by receipt.budgetUnit = heuristic-units: both renderings fit 4 * budget UTF-8 bytes. No model tokenizer, token upper-bound guarantee, or end-to-end cost reduction is claimed. Historical 817/body-only measurements and the real-data reporting harness now state their scope and unmeasured commands/receipts/retries.
The installed SDK already provides fitOutputEnvelope; no dependency pin changed. It owns convergence, finite work controls and skip admission, preserving caller row order and considering later smaller rows. The package supplies its inert JSON/TOON renderers and domain receipt. Per-format byte fields subtract the renderer-length difference from the SDK maximum: scalar accounting integers have the same decimal spelling in both formats, so that difference is independent of their digit widths. The SDK verifies the resulting complete envelope. Infeasible, unstable and work-limit errors retain safe typed remedies. Source completeness, first-bad/last-good semantics, exact omissions and executable restore instructions are preserved.
Companion G6 adoption was read-only; this PR changes only pm-http. Tracker: pm-http-33ck, retained in progress with the claim released for orchestrator verification.
Validation:
node --test --test-concurrency=2 test/packet.test.ts: 4/4 passed, also executed through pinned pm test --run --progress.
node --test --test-concurrency=2 test/http.test.ts test/commands.test.ts: 29/29 passed; includes actual host processes, SDK temp trackers, existing concurrency/crash schedules and both final renderer byte counts.
npm run typecheck, npm run lint, npm run docstring (96 declarations) and npm run duplication (0%): passed without gate/threshold changes.
Changelog regenerated after the last pm write; npm run changelog:check passed. Tracker history is a byte-prefix extension of main. Commit identity verified.
Full npm run release:check: passed with isolated HOME and Git configuration; 143/143 tests, 100/100/100/100 coverage across 20 configured source files, 2/2 packed npm/Bun investigations against the published minimum SDK 2026.10.28. The minimum SDK exports the fitter. Strict tracker health also passes with isolated HOME (the normal host global pm-github installation has a version-skew notice outside this package).
Full bun run release:check: passed serially, also 143/143 tests, 100/100/100/100 coverage, 2/2 packed npm/Bun investigations.
Prior-head CI: Node 22 and Node 26 passed, including full npm/Bun gates; CodeQL also passed on 12b71dc. Fresh Node 22/26 CI passed on final head c86bcf7f2cec9a12ff26161f6c512611bca55d6f, including full npm/Bun gates and packed acceptance; final-head CodeQL remains pending. The required explicit CodeRabbit review completed clean on the final head; the other reviewer skips/neutral notices are not approval.
Behavioral revert proofs: node test/revert.acceptance.ts issue5-packet issue5-packet-host issue5-skip issue5-byte-framing issue5-sdk-refusals: 5/5 passed. Each intentional revert ran in a disposable copy and failed its behavioral regression; restoring the fixed source passed again.
Revert
Observed regression
Original main differencePacket body, with its original helper imports
All three packet regressions fail: exact bytes, SDK receipt/admission, minimum/budget boundaries
Actual SDK infeasible/work-limit/unstable failures lose typed HTTP refusals
Follow-up c86bcf7 pins the revert harness to historical main e2074b1, so it remains reproducible after this fix lands. Production source is byte-identical to 12b71dc, which passed both local release gates. All five revert proofs, typecheck and lint passed again. A real disposable clone advanced origin/main to the fixed function: the pinned harness passed; restoring its former moving origin/main reference failed the identity check. Branch history remains a byte-prefix extension of current main; the claim is released and the changelog was regenerated after the final pm write.
Review loop:
1 completed full CodeRabbit round, covering e2074b1 through c86bcf7; completed review reports no actionable comments, and the completion reply confirms the full review finished. The whole body was read; no outside-diff or nitpick findings were present.
0 threads / 0 review comments: no fixes or refusals were needed. Every bot comment was voted; completion/quota notices were voted down and review content up.
CodeRabbit's sandbox could not run ESLint because a config dependency was unavailable. This is a reviewer-tool limitation; local and both CI matrix lint gates passed separately.
GitHub GraphQL rate limits blocked the supplied state/vote/watch helpers after review. REST independently confirmed the exact head, successful CodeRabbit and Node 22/26 checks, zero review comments, and all comment votes. Final-head CodeQL remained queued at the final CI handoff on 2026-11-06 16:46 UTC, about one hour after the last push. It has not executed and is not certified as passed. Node 22/26 full gates and the completed CodeRabbit review passed on the exact final head. The orchestrator must retain this pending scan as an explicit check.
Thread
Fix or refusal
None
No actionable findings in the completed full review
No merge or release is requested.
Summary by Sourcery
Expose exact packet byte costs and use the SDK fitter to produce verified, bounded difference packets with clear heuristic-budget semantics.
New Features:
Expose exact self-inclusive UTF-8 byte costs for JSON and TOON packet renderings, including newline and accounting fields.
Adopt the SDK output fitter for bounded packet construction, row admission, convergence, and typed fitting refusals.
Bug Fixes:
Ensure oversized rows are skipped while later smaller rows remain eligible and packet byte fields match the final rendered output.
Preserve actionable typed errors for infeasible, unstable, and work-limit fitting failures.
Enhancements:
Clarify that estimatedTokens and budget values are four-byte heuristic units rather than model-token measurements or guarantees.
Update architecture, README, changelog, and real-data documentation to describe exact byte accounting and measurement scope.
Expand behavioral and acceptance coverage for Unicode content, renderer framing, budget boundaries, SDK fitting behavior, and refusal handling.
Documentation:
Document exact JSON/TOON byte costs, SDK fitting semantics, heuristic budget units, and the limits of historical cost measurements.
Tests:
Add packet-focused tests covering exact byte accounting, row omission semantics, minimum and boundary budgets, and typed SDK refusal translation.
Extend native-host and revert acceptance tests to verify renderer byte counts, SDK adoption, and regression behavior.
Chores:
Regenerate the real-data report and retain tracker history and reproducibility metadata for the packet accounting change.
This repository does not receive automatic reviews because it has fewer than 10 stars.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 43064d8b-c15e-4477-93e0-998336625dcb
No actionable comments were generated in the recent review.
Summary by CodeRabbit
New Features
Difference packets now report exact UTF-8 byte counts for JSON and TOON, including the complete rendered output.
Packet budgets are expressed as byte-derived heuristic units, not guaranteed model-token limits. When fitting a packet, eligible rows can be retained even if an earlier row is too large.
Clearer errors are returned when a packet cannot be safely fitted.
Documentation
Updated guidance explains packet sizing, row selection, and the limitations of heuristic estimates.
Walkthrough
The packet now uses SDK envelope fitting to select rows and reports exact JSON and TOON UTF-8 byte counts. Its estimated token field remains as a heuristic-unit estimate. Error handling, tests, documentation, measurement reports, and project records were also updated.
differencePacket delegates row admission to the SDK fitter with the skip policy. Packet metadata reports JSON and TOON byte counts, while the estimated token field remains a heuristic. Tests cover fitting, omissions, byte counts, and budget boundaries.
A shared failure adapter maps fitting errors and other failures to refusals. Command handling uses the adapter. Tests check output byte counts, typed refusals, and mutation scenarios against historical implementations.
Measurement documentation and project records README.md, docs/real-data.md, test/real-data.acceptance.ts, CHANGELOG.md, .agents/pm/history/*, .agents/pm/issues/*
Documentation and reports distinguish byte-derived heuristic units from tokenizer counts and describe measurement scope. Project records include issue status, progress comments, tracked files, test commands, and documentation paths.
The reported packet byte-count concern is refuted; no actionable merge-blocking issue remains after normal checks.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title identifies the exact packet byte costs and SDK fitting changes.
Linked Issues check
[ #5 ] differencePacket reports self-inclusive JSON and TOON bytes and labels its budget as heuristic units. Documentation qualifies the historical 817 figure and body-only comparison. Packet tests …
Out of Scope Changes check
[ #5 ] SDK fitting and typed refusals support bounded, self-inclusive packet accounting. The documentation, regression tests, revert harness, changelog, and tracker updates support the same work. The …
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Description check
The description covers the packet byte fields, SDK fitting, documentation, and tests in the changeset.
Full details: Linked Issues check
Explanation
[ #5 ] differencePacket reports self-inclusive JSON and TOON bytes and labels its budget as heuristic units. Documentation qualifies the historical 817 figure and body-only comparison. Packet tests cover both renderers, Unicode, long digests, minimum receipts, omissions, and budget boundaries. Existing semantic tests and source-completeness behavior are preserved.
Full details: Out of Scope Changes check
Explanation
[ #5 ] SDK fitting and typed refusals support bounded, self-inclusive packet accounting. The documentation, regression tests, revert harness, changelog, and tracker updates support the same work. The summary shows no unrelated changes.
Full details: Docstring Coverage
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 8 files. (6 skipped: 6 unsupported.)
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 6fcac2b4-6641-4bf1-bb19-35178ce4cb8b
Commits
Reviewing files that changed from the base of the PR and between e2074b1 and c86bcf7.
Files selected for processing: 14
.agents/pm/history/pm-http-33ck.jsonl
.agents/pm/issues/pm-http-33ck.toon
ARCHITECTURE.md
CHANGELOG.md
README.md
docs/real-data.md
index.ts
src/commands.ts
src/core.ts
src/derive.ts
test/commands.test.ts
test/packet.test.ts
test/real-data.acceptance.ts
test/revert.acceptance.ts
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Expose the difference-packet byte costs and SDK fit receipt, and retain the compatibility estimate as heuristic units.
index.ts L22
src/derive.ts L2-4, L83-104
Uses of the API
Adapt command error handling to present the new typed fitting refusals safely through the native CLI.
src/commands.ts L7, L18
Implementation
Use the SDK estimator for the compatibility value and translate SDK fitting failures into safe package errors.
src/core.ts L3, L33-34, L47-56
Documentation
Document the SDK fitting model, exact renderer byte accounting, heuristic budget semantics, and the scope of historical measurements.
.agents/pm/history/pm-http-33ck.jsonl L2-15
.agents/pm/issues/pm-http-33ck.toon L5-32
ARCHITECTURE.md L53
CHANGELOG.md L14-17
README.md L110, L121, L131
docs/real-data.md L10-11, L17-20
Tests
Verify exact final-renderer byte counts, SDK row admission and refusal behavior, CLI output, and reproducible behavioral reverts.
test/commands.test.ts L31-33
test/packet.test.ts L1-94
test/real-data.acceptance.ts L27-30
test/revert.acceptance.ts L23, L59-63, L74-76
Tips and commands
Interacting with Sourcery
Trigger a new review: Comment @sourcery-ai review on the pull request.
Continue discussions: Reply directly to Sourcery's review comments.
Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with @sourcery-ai issue to create an issue from it.
Generate a pull request title: Write @sourcery-ai anywhere in the pull
request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
Generate a pull request summary: Write @sourcery-ai summary anywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment @sourcery-ai summary on the pull request to
(re-)generate the summary at any time.
Generate reviewer's guide: Comment @sourcery-ai guide on the pull
request to (re-)generate the reviewer's guide at any time.
Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5
The initial main baseline
e2074b1exposed onlyceil(max(JSON,TOON UTF-8 bytes)/4)under a token-shaped compatibility field. It had no exact per-renderer byte costs and maintained its own unbounded fixed-point loop. Two failing-first tests reproduced the missing byte API in real temporary non-git SDK trackers; the Unicode/digest fixture measured 2301 JSON / 1775 TOON bytes while the byte fields were absent.The packet now exposes exact self-inclusive
bytes.jsonandbytes.toon, including the final renderer newline and all domain/SDK accounting fields. The compatibilityestimatedTokensfield remains, explicitly labeled byreceipt.budgetUnit = heuristic-units: both renderings fit4 * budgetUTF-8 bytes. No model tokenizer, token upper-bound guarantee, or end-to-end cost reduction is claimed. Historical 817/body-only measurements and the real-data reporting harness now state their scope and unmeasured commands/receipts/retries.The installed SDK already provides
fitOutputEnvelope; no dependency pin changed. It owns convergence, finite work controls andskipadmission, preserving caller row order and considering later smaller rows. The package supplies its inert JSON/TOON renderers and domain receipt. Per-format byte fields subtract the renderer-length difference from the SDK maximum: scalar accounting integers have the same decimal spelling in both formats, so that difference is independent of their digit widths. The SDK verifies the resulting complete envelope. Infeasible, unstable and work-limit errors retain safe typed remedies. Source completeness, first-bad/last-good semantics, exact omissions and executable restore instructions are preserved.Companion G6 adoption was read-only; this PR changes only pm-http. Tracker: pm-http-33ck, retained in progress with the claim released for orchestrator verification.
Validation:
node --test --test-concurrency=2 test/packet.test.ts: 4/4 passed, also executed through pinnedpm test --run --progress.node --test --test-concurrency=2 test/http.test.ts test/commands.test.ts: 29/29 passed; includes actual host processes, SDK temp trackers, existing concurrency/crash schedules and both final renderer byte counts.npm run typecheck,npm run lint,npm run docstring(96 declarations) andnpm run duplication(0%): passed without gate/threshold changes.npm run changelog:checkpassed. Tracker history is a byte-prefix extension of main. Commit identity verified.npm run release:check: passed with isolated HOME and Git configuration; 143/143 tests, 100/100/100/100 coverage across 20 configured source files, 2/2 packed npm/Bun investigations against the published minimum SDK 2026.10.28. The minimum SDK exports the fitter. Strict tracker health also passes with isolated HOME (the normal host global pm-github installation has a version-skew notice outside this package).bun run release:check: passed serially, also 143/143 tests, 100/100/100/100 coverage, 2/2 packed npm/Bun investigations.12b71dc. Fresh Node 22/26 CI passed on final headc86bcf7f2cec9a12ff26161f6c512611bca55d6f, including full npm/Bun gates and packed acceptance; final-head CodeQL remains pending. The required explicit CodeRabbit review completed clean on the final head; the other reviewer skips/neutral notices are not approval.Behavioral revert proofs:
node test/revert.acceptance.ts issue5-packet issue5-packet-host issue5-skip issue5-byte-framing issue5-sdk-refusals: 5/5 passed. Each intentional revert ran in a disposable copy and failed its behavioral regression; restoring the fixed source passed again.differencePacketbody, with its original helper importsdifferencePacket, native host testFollow-up
c86bcf7pins the revert harness to historical maine2074b1, so it remains reproducible after this fix lands. Production source is byte-identical to12b71dc, which passed both local release gates. All five revert proofs, typecheck and lint passed again. A real disposable clone advancedorigin/mainto the fixed function: the pinned harness passed; restoring its former movingorigin/mainreference failed the identity check. Branch history remains a byte-prefix extension of current main; the claim is released and the changelog was regenerated after the final pm write.Review loop:
e2074b1throughc86bcf7; completed review reports no actionable comments, and the completion reply confirms the full review finished. The whole body was read; no outside-diff or nitpick findings were present.No merge or release is requested.
Summary by Sourcery
Expose exact packet byte costs and use the SDK fitter to produce verified, bounded difference packets with clear heuristic-budget semantics.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests:
Chores: